package TAIC.util;

import java.io.File;
import java.io.PrintStream;
import java.util.Scanner;

public class ODPStatistic {

	/**
	 * 
	 * It is cales statistics of the files in ODP Text Corpus  
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		if ( args.length != 1 )	{
			System.out.println( "please input the config file" );
			return ;
		}
		PrintStream fout = new PrintStream ( new File ( "odpInfo.txt")	) ;   
		Scanner scanner = new Scanner ( new File ( args [ 0 ] )); 
		while ( scanner.hasNext() ) {
			String cateName = scanner.next() ;
			String dirName = cateName.substring( 0, cateName.indexOf('.')); 
			Scanner configScanner = new Scanner ( new File ( dirName + "\\index.txt"));
			int count = 0 ; 
			while ( configScanner.hasNext()) { 
				configScanner.next() ;
				count ++ ; 
			}
			fout.println( cateName + "\t" + count );
			configScanner.close(); 
		}
		fout.close() ;
		scanner.close();	
	}

}
